package com.hermes.comics;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.hermes.comics.R;
import com.hermes.comics.data.Constants;

public class WebExtractionActivity extends Activity  {

  private static String GDQ_URL = "http://www.guiadosquadrinhos.com/titulos.aspx?busca=";

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getActionBar().setDisplayShowTitleEnabled(true);
    getActionBar().setDisplayUseLogoEnabled(true);
    getActionBar().setSubtitle(R.string.web_extraction);

    setContentView(R.layout.web_extraction);

    WebView browser = (WebView) findViewById(R.id.browser);
    browser.setWebViewClient(new WebViewClient() {
      @Override
      public boolean shouldOverrideUrlLoading(WebView webview, String url) {
        Uri uri = Uri.parse(url);

        View panel = (View) WebExtractionActivity.this.findViewById(R.id.button_panel);
        panel.setVisibility("/edicao.aspx".equals(uri.getPath())
            ? View.VISIBLE : View.GONE);

        return false;
      }
    });

    browser.loadUrl(GDQ_URL + "1000-1");
  }

  public void onClick(View view) {
  }
}
